package com.taihe.service.impl;

import com.github.pagehelper.PageHelper;
import com.taihe.dao.SysUserMapper;
import com.taihe.domain.SysUser;
import com.taihe.domain.SysUserExample;
import com.taihe.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by zwt09 on 2018/12/3.
 */
@Service
public class SysUserServiceImpl implements SysUserService {

    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public List<SysUser> queryPage(Map<String, Object> params) {
        SysUserExample sysUserExample = new SysUserExample();
        SysUserExample.Criteria criteria = sysUserExample.createCriteria();
        if(null!=params.get("username")){
            criteria.andUsernameLike("%"+params.get("username")+"%");
        }
        PageHelper.startPage((Integer) params.get("page"),(Integer) params.get("limit"));
        List<SysUser> sysUsers = sysUserMapper.selectByExample(sysUserExample);
        return sysUsers;
    }
}
